home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / imengv3.41p1.lha / ImEngV3.41p1 / ARexx / EdgeEffect.rexx < prev    next >
OS/2 REXX Batch file  |  1999-09-18  |  2KB  |  101 lines

  1. /*************************************/
  2. /* Image Engineer Macro script       */
  3. /* by Simon Edwards                  */
  4. /* 27/3/96                           */
  5. /*                                   */
  6. /* MS: external pictures now use     */
  7. /*     zoomlevel of original picture */
  8. /*                                   */
  9. /* Edge Effect v1.00                 */
  10. /*************************************/
  11.  
  12. Options results
  13. signal on error            /* Setup a place for errors to go */
  14.  
  15. if arg()==0 then exit
  16. pic=arg(1)
  17.  
  18. PROJECT_INFO pic WIDTH
  19. picwidth=result
  20. PROJECT_INFO pic HEIGHT
  21. picheight=result
  22. PROJECT_INFO pic ZOOM
  23. origzoomval=result
  24.  
  25. 'REQUEST "Image to use for alpha channel" "Spherical|Spherical2|Gradient|Highlight|Highlight2"'
  26. reply=RESULT
  27.  
  28. if reply==0 then alphaname='IE:alpha/Spherical.alpha'
  29. if reply==1 then alphaname='IE:alpha/Spherical2.alpha'
  30. if reply==2 then alphaname='IE:alpha/Gradient.alpha'
  31. if reply==3 then alphaname='IE:alpha/highlight.alpha'
  32. if reply==4 then alphaname='IE:alpha/highlight2.alpha'
  33.  
  34. 'OPEN "'||alphaname||'" 8BIT'
  35. alphachannel=result
  36.  
  37. PROJECT_SET alphachannel ZOOM origzoomval
  38.  
  39. SCALE alphachannel picwidth picheight BEST
  40. newalpha=result
  41. CLOSE alphachannel
  42.  
  43. 'GET_FILE "Choose Image to apply to edge" "Ok" "ram:"'
  44. edgeeffectname=RESULT
  45.  
  46. 'OPEN "'||edgeeffectname||'" 8BIT'
  47. edgeimage=RESULT
  48.  
  49. PROJECT_SET edgeimage ZOOM origzoomval
  50.  
  51. RESIZE edgeimage picwidth picheight TILE
  52. newedgeimage=RESULT
  53. CLOSE edgeimage
  54.  
  55. HISTOGRAM_EQUALIZATION newedgeimage
  56. edgeimage=RESULT
  57. CLOSE newedgeimage
  58.  
  59. CONTRAST_STRETCH edgeimage
  60. newedgeimage=RESULT
  61. CLOSE edgeimage
  62.  
  63. 'CONTRAST '||newedgeimage||' -1'
  64. edgeimage=RESULT
  65. CLOSE newedgeimage
  66.  
  67. MARK edgeimage PRIMARY
  68. MARK newalpha ALPHA
  69. HALFTONE
  70. resultalpha=RESULT
  71.  
  72. CLOSE newalpha
  73. CLOSE edgeimage
  74.  
  75. NEGATIVE resultalpha
  76. newalpha=RESULT
  77.  
  78. CLOSE resultalpha
  79.  
  80. MARK newalpha ALPHA
  81.  
  82. exit
  83.  
  84. /*******************************************************************/
  85. /* This is where control goes when an error code is returned by IE */
  86. /* It puts up a message saying what happened and on which line     */
  87. /*******************************************************************/
  88. error:
  89. if RC=5 then do            /* Did the user just cancel us? */
  90.     IE_TO_FRONT
  91.     LAST_ERROR
  92.     'REQUEST "'||RESULT||'"'
  93.     exit
  94. end
  95. else do
  96.     IE_TO_FRONT
  97.     LAST_ERROR
  98.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  99.     exit
  100. end
  101.